package com.sskj.qiangjin.ui.activity;


import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.flyco.tablayout.SlidingTabLayout;
import com.sskj.common.adapter.MyFragmentPagerAdapter;
import com.sskj.common.base.App;
import com.sskj.common.widget.ViewPagerSlide;
import com.sskj.lib.Constans;
import com.sskj.lib.RConfig;
import com.sskj.qiangjin.R;
import com.sskj.qiangjin.presenter.AssetRecordActivityPresenter;
import com.sskj.lib.base.BaseActivity;

import java.util.ArrayList;

import butterknife.BindView;

@Route(path = RConfig.APP_ASSET_RECORD)//资产记录
public class AssetRecordActivity extends BaseActivity<AssetRecordActivityPresenter> {
    @BindView(R.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R.id.viewPager)
    ViewPager viewPager;
    @Autowired
    String moneyType;

    @Override
    protected int getLayoutResId() {
        return R.layout.app_activity_asset_record;
    }

    @Override
    public AssetRecordActivityPresenter getPresenter() {
        return new AssetRecordActivityPresenter();
    }


    @Override
    protected void initView() {
        setTitle(App.INSTANCE.getString(R.string.app_activity_my_asset));
        ARouter.getInstance().inject(this);

        ArrayList<Fragment> fragments = new ArrayList<>();
        ArrayList<String> titles = new ArrayList<>();
        titles.add("充币记录");
        titles.add("提币记录");
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.APP_FRAGMENT_RECHARGE_RECORD).withString(Constans.MONEY_TYPE, moneyType).navigation());
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.APP_FRAGMENT_WITHDRAW_RECORD).withString(Constans.MONEY_TYPE, moneyType).navigation());
        viewPager.setOffscreenPageLimit(2);
        viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), titles, fragments));
        slidingTabLayout.setViewPager(viewPager);

    }


}
